package network.udp;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDictServer extends UdpEchoServer {
    private final Map<String, String> dict = new HashMap<>();

    public UdpDictServer(int port) throws SocketException {
        super(port);
        dict.put("光光", "Hikari");
        dict.put("对立", "Tairitsu");
    }

    @Override
    protected String process(String request) {
        return dict.getOrDefault(request, "未知查询");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer sever = new UdpDictServer(9091);
        sever.start();
    }
}
